public class People
{
	protected String name;
	protected String surname;
	protected int age;

	public People(String name, String surname, int age)
	{
		this.name = name;
		this.surname = surname;
		this.age = age;
	}

	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + age;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + ((surname == null) ? 0 : surname.hashCode());
		return result;
	}


	public boolean equals(Object obj)
	{
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		People other = (People) obj;
		if (age != other.age)
			return false;
		if (name == null)
		{
			if (other.name != null)
				return false;
		}
		else if (!name.equals(other.name))
			return false;
		if (surname == null)
		{
			if (other.surname != null)
				return false;
		}
		else if (!surname.equals(other.surname))
			return false;
		return true;
	}

	public int compareTo(People p)
	{
		if (getAge() == p.getAge())
			return 0;
		else if (getAge() > p.getAge())
			return 1;
		else
			return -1;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getSurname()
	{
		return surname;
	}

	public void setSurname(String surname)
	{
		this.surname = surname;
	}

	public int getAge()
	{
		return age;
	}

	public void setAge(int age)
	{
		this.age = age;
	}

}
